<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增项目成员管理')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-people-add">
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">项目名称：</label>
                <div class="col-sm-4">
                    <input name="gcProjectName" id="gcProjectName" class="form-control" type="text" th:value="${gcProject.name}" readonly="readonly" autoComplete="off">
                	<input name="gcProjectid" id="gcProjectid" type="hidden" th:value="${gcProject.id}" >
                	<input name="code" id="code" type="hidden">
                    <input name="deptName" id="deptName" type="hidden">
                    <input name="pId" id="pId" type="hidden" value="0" />
                </div>
                <label class="col-sm-2 control-label is-required">姓名：</label>
                <div class="col-sm-4">
                	<div class="input-group">
                    	<input name="name" onclick="selectUser()" required id="name" type="text" placeholder="请选择" readonly="readonly" class="form-control">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-2 control-label is-required">角色：</label>
                <div class="col-sm-4">
                	<select name="ruleName" class="form-control" required th:with="type=${@dict.getType('sj_gzgw')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
                <label class="col-sm-2 control-label is-required">权重：</label>
                <div class="col-sm-4">
                    <input name="qz" class="form-control" required type="text">
                </div>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "sj/people"
        
        $("#form-people-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/add", $('#form-people-add').serialize());
            }
        }
        
		function selectUser() {
			var options = {
		       title: '选择用户',
		       url: "/sj/config/invokeUser",
		       callBack: doSubmitUser
		    };
		    $.modal.openOptions(options);
		}
        
        function doSubmitUser(index, layero){
            var rows = layero.find("iframe")[0].contentWindow.getSelections();
            if (rows.length == 0) {
                $.modal.alertWarning("请至少选择一条记录");
                return;
            }
            
          	//--------lable赋值
            $("#code").val(rows[0].userId);
            $("#name").val(rows[0].userName);
            $("#deptName").val(rows[0].dept.deptName);
            $.modal.closeAll();
        }
    </script>
</body>
</html>